package thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 74646
 * Date: 2022-04-23
 * Time: 16:18
 */
public class TestDemo7 {
    public static void main(String[] args) {
        Thread t1  = new Thread(()->{
            while (true){
                System.out.println("hello Thread1");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"thread1");
        t1.start();

        Thread t2 = new Thread(()->{
            while (true){
                System.out.println("hello Thread2");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"thread2");
        t2.start();
    }
}
